using UnityEngine;

public class EnemyState
{
    protected EnemyStateMachine StateMachine { get; private set; }
    protected Enemy Enemy;
    protected Rigidbody2D Rb { get; private set; }
    protected bool TriggerCalled { get; private set; }
    protected string AnimName { get; private set; }
    protected float stateTimer;

    public EnemyState(Enemy enemy, string animName)
    {
        Enemy = enemy;
        AnimName = animName;
        StateMachine = enemy.StateMachine;
        Rb = enemy.Rb;
    }

    public virtual void Enter()
    {
        Enemy.Anim.SetBool(AnimName, true);
        TriggerCalled = false;
    }

    public virtual void Update()
    {
        stateTimer -= Time.deltaTime;
    }

    public virtual void Exit()
    {
        Enemy.Anim.SetBool(AnimName, false);
        Enemy.AssignLastAnimName(AnimName);
    }

    public virtual void AnimationFinishTrigger()
    {
        TriggerCalled = true;
    }
}
